#include "mydialog.h"
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>

MyDialog::MyDialog(QWidget* parent)
    :QDialog(parent)
{
    //以QDialog为父窗口
    QLabel* label = new QLabel("哈哈哈哈", this);
    QPushButton* button = new QPushButton("按钮", this);

    QVBoxLayout* layout = new QVBoxLayout();
    this->setLayout(layout);

    layout->addWidget(label);
    layout->addWidget(button);
}
